package com.xjl.service.impl;

import java.io.IOException;
import java.util.List;

import com.xjl.dao.UserDao;
import com.xjl.dao.impl.UserDaoImpl;
import com.xjl.demo.PageInfo;
import com.xjl.demo.User;
import com.xjl.service.UserService;

public class UserServiceImpl implements UserService {
	//建立UserDao对象
	UserDao userdao = new UserDaoImpl();
	//查询所有会员信息

	@Override
	public PageInfo showPage(int pageSize, int pageNumber) throws IOException {
		
		PageInfo pi = new PageInfo();
		pi.setPageNumber(pageNumber);
		pi.setPageSize(pageSize);
	
		pi.setList(userdao.SelectAllUser(pageSize*(pageNumber-1), pageSize));
		
		//总条数
		long count = userdao.CountUserDao();
		
		pi.setTotal(count%pageSize==0?count/pageSize:count/pageSize+1);
		return pi;
	}

	@Override
	public int DeleteUserByIdService(int uid) {
		return userdao.DeleteUserByIdDao(uid);
	}

}


